package com.nancy.java_design.decorator.demo1;

/**
 * 具体装饰器：鸡蛋
 *
 */
public class Eggdecorator extends Decorator{

    public Eggdecorator(FastFood fastFood) {
        // 调用父类的构造方法，传入价格和描述信息
        super(2,"鸡蛋",fastFood);
    }

    @Override
    public float cost() {
        // 返回装饰品的价格加上被装饰的食物的价格
        return getPrice() + getFastFood().getPrice();
    }
}
